<!-- List of Manga -->
<div class="tab-pane active">
    <div class="iWidgets" align="center">
        <a class="iWidget" rel="tipsyN" href="/novel/add" original-title="Add new novel">
            <img alt="Add new manga" src="<?php echo base_url() ?>assets/img/icons/24x24/add.png">
        </a>
    </div>
    <div class="divider"><div><span></span></div></div>
    <div class="dataTables_wrapper" role="grid">
        <table cellspacing="0" border="0" class="dTable dataTable" cellpading="0" id="list_all_manga">
            <thead align="left">
                <tr role="row">
                    <th rowspan="2" style="width: 50px;">
                        Cover
                    </th>
                    <th rowspan="2">
                        <i class="icon-book"></i>
                        Name
                    </th>
                    <th rowspan="2">
                        Other Name
                    </th>
                    <th rowspan="2">
                        <i class="icon-user"></i>
                        Author
                    </th>
                    <th rowspan="2">
                        <i class="icon-user"></i>
                        Translator
                    </th>
                    <th rowspan="2" align="center">
                        <i class="icon-flag"></i>
                        Status 
                    </th>
                    <th rowspan="2" align="center">
                        <i class="icon-time"></i>
                        Last Edit
                    </th>
                    <th align="center" colspan="2">
                        <i class="icon-cog"></i>
                    </th>
                </tr>
                <tr>
                    <td></td>
                    <td></td>
                </tr>
            </thead>
            <tbody>
                <?php
                $menu = array();
                foreach ($novel as $m):
                    $status = $m->status == 1 ? 'Updating' : ($m->status == 2 ? 'Finish' : 'Stop');
                    $status_img = $m->status == 1 ? 'bOlive' : ($m->status == 2 ? 'bSky' : 'bMuddy');
                    $lst_login = $m->update == 0 ? $m->created : $m->update;
                    
                    $char = slug($m->name[0]);
                    if(!in_array($char, $menu)) {
                        $menu[] = $char;
                ?>
                    <tr class="new even" style="background-color: #7AADEB; color: #FFF;">
                        <td colspan="9"><h1><?php echo strtoupper($m->name[0]) ?></h1></td>
                    </tr>
                <?php }?>
                    <tr class="new even" id="mangaRow_<?= $m->id ?>">
                        <td align="center">
                            <a style="padding: 5px;display: block;" href="<?php echo base_url() ?>novel/edit/<?= $m->id ?>">
                                <img width="50" src="<?php echo STATIC_URL . ($m->cover != '' ? $m->cover : DEFAULT_IMG) ?>" />
                            </a>
                        </td>
                        <td>
                            <a style="padding: 5px;display: block;" href="<?php echo base_url() ?>novel/edit/<?= $m->id ?>">
                                <?= $m->name ?>
                            </a>    
                        </td>
                        <td>
                            <?= $m->oname ?>
                        </td>
                        <td>
                            <?= $m->author ?>
                        </td>
                        <td>
                            <?= $m->translator ?>
                        </td>
                        <td align="center">
                            <span class="label <?= $status_img ?>"><?= $status ?></span>
                        </td>
                        <td align="center">
                            <?= date('d M Y - H:i', $lst_login) ?>
                        </td>
                        <td align="center" >
                            <a rel="tipsyN" href="<?php echo base_url() ?>novel/edit/<?= $m->id ?>" original-title="Edit Manga">
                                <img alt="" src="<?php echo base_url() ?>assets/img/icons/14x14/pen4.png">
                            </a>
                        </td>
                        <td align="center">
                            <a href="#" id="removeManga_<?= $m->id ?>" rel="<?= $m->name ?>" class="removeManga" original-title="Delete User">
                                <img alt="" src="<?php echo base_url() ?>assets/img/icons/14x14/trash.png">
                            </a>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>